aloop 0.1.1__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.
- agent/__init__.py +0 -0
- agent/agent.py +182 -0
- agent/base.py +406 -0
- agent/context.py +126 -0
- agent/prompts/__init__.py +1 -0
- agent/todo.py +149 -0
- agent/tool_executor.py +54 -0
- agent/verification.py +135 -0
- aloop-0.1.1.dist-info/METADATA +252 -0
- aloop-0.1.1.dist-info/RECORD +66 -0
- aloop-0.1.1.dist-info/WHEEL +5 -0
- aloop-0.1.1.dist-info/entry_points.txt +2 -0
- aloop-0.1.1.dist-info/licenses/LICENSE +21 -0
- aloop-0.1.1.dist-info/top_level.txt +9 -0
- cli.py +19 -0
- config.py +146 -0
- interactive.py +865 -0
- llm/__init__.py +51 -0
- llm/base.py +26 -0
- llm/compat.py +226 -0
- llm/content_utils.py +309 -0
- llm/litellm_adapter.py +450 -0
- llm/message_types.py +245 -0
- llm/model_manager.py +265 -0
- llm/retry.py +95 -0
- main.py +246 -0
- memory/__init__.py +20 -0
- memory/compressor.py +554 -0
- memory/manager.py +538 -0
- memory/serialization.py +82 -0
- memory/short_term.py +88 -0
- memory/store/__init__.py +6 -0
- memory/store/memory_store.py +100 -0
- memory/store/yaml_file_memory_store.py +414 -0
- memory/token_tracker.py +203 -0
- memory/types.py +51 -0
- tools/__init__.py +6 -0
- tools/advanced_file_ops.py +557 -0
- tools/base.py +51 -0
- tools/calculator.py +50 -0
- tools/code_navigator.py +975 -0
- tools/explore.py +254 -0
- tools/file_ops.py +150 -0
- tools/git_tools.py +791 -0
- tools/notify.py +69 -0
- tools/parallel_execute.py +420 -0
- tools/session_manager.py +205 -0
- tools/shell.py +147 -0
- tools/shell_background.py +470 -0
- tools/smart_edit.py +491 -0
- tools/todo.py +130 -0
- tools/web_fetch.py +673 -0
- tools/web_search.py +61 -0
- utils/__init__.py +15 -0
- utils/logger.py +105 -0
- utils/model_pricing.py +49 -0
- utils/runtime.py +75 -0
- utils/terminal_ui.py +422 -0
- utils/tui/__init__.py +39 -0
- utils/tui/command_registry.py +49 -0
- utils/tui/components.py +306 -0
- utils/tui/input_handler.py +393 -0
- utils/tui/model_ui.py +204 -0
- utils/tui/progress.py +292 -0
- utils/tui/status_bar.py +178 -0
- utils/tui/theme.py +165 -0
utils/tui/theme.py
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"""Theme system for TUI with dark and light mode support."""
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Dict
|
|
5
|
+
|
|
6
|
+
from rich.style import Style
|
|
7
|
+
from rich.theme import Theme as RichTheme
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@dataclass
|
|
11
|
+
class ThemeColors:
|
|
12
|
+
"""Color palette for a TUI theme."""
|
|
13
|
+
|
|
14
|
+
# Primary colors
|
|
15
|
+
primary: str # Main accent color
|
|
16
|
+
secondary: str # Secondary accent
|
|
17
|
+
success: str # Success/positive
|
|
18
|
+
warning: str # Warning/caution
|
|
19
|
+
error: str # Error/negative
|
|
20
|
+
|
|
21
|
+
# Background colors
|
|
22
|
+
bg_primary: str # Main background
|
|
23
|
+
bg_secondary: str # Panel/card background
|
|
24
|
+
bg_highlight: str # Highlighted areas
|
|
25
|
+
|
|
26
|
+
# Text colors
|
|
27
|
+
text_primary: str # Primary text
|
|
28
|
+
text_secondary: str # Secondary/muted text
|
|
29
|
+
text_muted: str # Very muted text
|
|
30
|
+
|
|
31
|
+
# Semantic colors
|
|
32
|
+
user_input: str # User input text
|
|
33
|
+
assistant_output: str # Assistant output text
|
|
34
|
+
tool_accent: str # Tool call highlights
|
|
35
|
+
thinking_accent: str # Thinking process highlights
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
# Dark theme - Professional, high contrast
|
|
39
|
+
DARK_THEME = ThemeColors(
|
|
40
|
+
primary="#00D9FF", # Bright cyan
|
|
41
|
+
secondary="#A78BFA", # Soft purple
|
|
42
|
+
success="#10B981", # Emerald green
|
|
43
|
+
warning="#F59E0B", # Amber
|
|
44
|
+
error="#EF4444", # Red
|
|
45
|
+
bg_primary="#0D1117", # Deep blue-black
|
|
46
|
+
bg_secondary="#161B22", # Slightly lighter
|
|
47
|
+
bg_highlight="#21262D", # Highlight background
|
|
48
|
+
text_primary="#F0F6FC", # Bright white
|
|
49
|
+
text_secondary="#8B949E", # Gray
|
|
50
|
+
text_muted="#484F58", # Dark gray
|
|
51
|
+
user_input="#00D9FF", # Cyan
|
|
52
|
+
assistant_output="#F0F6FC", # White
|
|
53
|
+
tool_accent="#F78166", # Orange
|
|
54
|
+
thinking_accent="#A371F7", # Purple
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
# Light theme - Clean, professional
|
|
58
|
+
LIGHT_THEME = ThemeColors(
|
|
59
|
+
primary="#0969DA", # Blue
|
|
60
|
+
secondary="#8250DF", # Purple
|
|
61
|
+
success="#1A7F37", # Green
|
|
62
|
+
warning="#9A6700", # Amber
|
|
63
|
+
error="#CF222E", # Red
|
|
64
|
+
bg_primary="#FFFFFF", # White
|
|
65
|
+
bg_secondary="#F6F8FA", # Light gray
|
|
66
|
+
bg_highlight="#EAEEF2", # Slightly darker
|
|
67
|
+
text_primary="#1F2328", # Near black
|
|
68
|
+
text_secondary="#57606A", # Medium gray
|
|
69
|
+
text_muted="#8C959F", # Light gray
|
|
70
|
+
user_input="#0969DA", # Blue
|
|
71
|
+
assistant_output="#1F2328", # Dark
|
|
72
|
+
tool_accent="#BC4C00", # Orange
|
|
73
|
+
thinking_accent="#8250DF", # Purple
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class Theme:
|
|
78
|
+
"""TUI Theme manager."""
|
|
79
|
+
|
|
80
|
+
_current_theme: str = "dark"
|
|
81
|
+
_themes: Dict[str, ThemeColors] = {
|
|
82
|
+
"dark": DARK_THEME,
|
|
83
|
+
"light": LIGHT_THEME,
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@classmethod
|
|
87
|
+
def get_colors(cls) -> ThemeColors:
|
|
88
|
+
"""Get the current theme colors."""
|
|
89
|
+
return cls._themes[cls._current_theme]
|
|
90
|
+
|
|
91
|
+
@classmethod
|
|
92
|
+
def set_theme(cls, name: str) -> None:
|
|
93
|
+
"""Set the current theme.
|
|
94
|
+
|
|
95
|
+
Args:
|
|
96
|
+
name: Theme name ('dark' or 'light')
|
|
97
|
+
|
|
98
|
+
Raises:
|
|
99
|
+
ValueError: If theme name is invalid
|
|
100
|
+
"""
|
|
101
|
+
if name not in cls._themes:
|
|
102
|
+
raise ValueError(f"Unknown theme: {name}. Available: {list(cls._themes.keys())}")
|
|
103
|
+
cls._current_theme = name
|
|
104
|
+
|
|
105
|
+
@classmethod
|
|
106
|
+
def get_theme_name(cls) -> str:
|
|
107
|
+
"""Get the current theme name."""
|
|
108
|
+
return cls._current_theme
|
|
109
|
+
|
|
110
|
+
@classmethod
|
|
111
|
+
def get_rich_theme(cls) -> RichTheme:
|
|
112
|
+
"""Get a Rich Theme object for the current theme."""
|
|
113
|
+
colors = cls.get_colors()
|
|
114
|
+
return RichTheme(
|
|
115
|
+
{
|
|
116
|
+
# Primary styles
|
|
117
|
+
"primary": Style(color=colors.primary),
|
|
118
|
+
"secondary": Style(color=colors.secondary),
|
|
119
|
+
"success": Style(color=colors.success),
|
|
120
|
+
"warning": Style(color=colors.warning),
|
|
121
|
+
"error": Style(color=colors.error),
|
|
122
|
+
# Text styles
|
|
123
|
+
"text": Style(color=colors.text_primary),
|
|
124
|
+
"text.secondary": Style(color=colors.text_secondary),
|
|
125
|
+
"text.muted": Style(color=colors.text_muted),
|
|
126
|
+
# Semantic styles
|
|
127
|
+
"user": Style(color=colors.user_input, bold=True),
|
|
128
|
+
"assistant": Style(color=colors.assistant_output),
|
|
129
|
+
"tool": Style(color=colors.tool_accent),
|
|
130
|
+
"thinking": Style(color=colors.thinking_accent),
|
|
131
|
+
# UI element styles
|
|
132
|
+
"panel.border": Style(color=colors.text_muted),
|
|
133
|
+
"status.label": Style(color=colors.text_secondary),
|
|
134
|
+
"status.value": Style(color=colors.text_primary),
|
|
135
|
+
"divider": Style(color=colors.text_muted),
|
|
136
|
+
# Prompt styles
|
|
137
|
+
"prompt": Style(color=colors.user_input, bold=True),
|
|
138
|
+
"prompt.symbol": Style(color=colors.primary, bold=True),
|
|
139
|
+
}
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
@classmethod
|
|
143
|
+
def get_prompt_toolkit_style(cls) -> Dict[str, str]:
|
|
144
|
+
"""Get style dict for prompt_toolkit."""
|
|
145
|
+
colors = cls.get_colors()
|
|
146
|
+
return {
|
|
147
|
+
"prompt": colors.user_input,
|
|
148
|
+
"prompt.symbol": f"{colors.primary} bold",
|
|
149
|
+
"": colors.text_primary, # Default text
|
|
150
|
+
"completion-menu": f"bg:{colors.bg_secondary} {colors.text_primary}",
|
|
151
|
+
"completion-menu.completion": f"bg:{colors.bg_secondary} {colors.text_primary}",
|
|
152
|
+
"completion-menu.completion.current": f"bg:{colors.primary} {colors.bg_primary}",
|
|
153
|
+
"scrollbar.background": colors.bg_secondary,
|
|
154
|
+
"scrollbar.button": colors.text_muted,
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def get_theme() -> ThemeColors:
|
|
159
|
+
"""Get the current theme colors (convenience function)."""
|
|
160
|
+
return Theme.get_colors()
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def set_theme(name: str) -> None:
|
|
164
|
+
"""Set the current theme (convenience function)."""
|
|
165
|
+
Theme.set_theme(name)
|