todo-agent 0.2.3__tar.gz → 0.2.4__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.
- {todo_agent-0.2.3 → todo_agent-0.2.4}/PKG-INFO +1 -1
- {todo_agent-0.2.3 → todo_agent-0.2.4}/tests/test_core/test_conversation_manager.py +1 -1
- {todo_agent-0.2.3 → todo_agent-0.2.4}/todo_agent/_version.py +3 -3
- {todo_agent-0.2.3 → todo_agent-0.2.4}/todo_agent/core/conversation_manager.py +1 -1
- {todo_agent-0.2.3 → todo_agent-0.2.4}/todo_agent/interface/cli.py +29 -1
- {todo_agent-0.2.3 → todo_agent-0.2.4}/todo_agent/interface/formatters.py +63 -5
- {todo_agent-0.2.3 → todo_agent-0.2.4}/todo_agent.egg-info/PKG-INFO +1 -1
- {todo_agent-0.2.3 → todo_agent-0.2.4}/.gitignore +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/LICENSE +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/MANIFEST.in +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/Makefile +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/README.md +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/docs/publishing.md +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/pyproject.toml +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/requirements-dev.txt +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/requirements.txt +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/setup.cfg +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/tests/__init__.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/tests/test_core/__init__.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/tests/test_core/test_todo_manager.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/tests/test_infrastructure/__init__.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/tests/test_infrastructure/test_config.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/tests/test_infrastructure/test_inference.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/tests/test_infrastructure/test_llm_client_factory.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/tests/test_infrastructure/test_ollama_client.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/tests/test_infrastructure/test_openrouter_client.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/tests/test_infrastructure/test_todo_shell.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/tests/test_infrastructure/test_token_counter.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/tests/test_interface/__init__.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/tests/test_interface/test_cli.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/tests/test_interface/test_tools.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/tests/test_linting.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/tests/test_logger.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/tests/test_main.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/todo_agent/__init__.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/todo_agent/core/__init__.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/todo_agent/core/exceptions.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/todo_agent/core/todo_manager.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/todo_agent/infrastructure/__init__.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/todo_agent/infrastructure/config.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/todo_agent/infrastructure/inference.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/todo_agent/infrastructure/llm_client.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/todo_agent/infrastructure/llm_client_factory.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/todo_agent/infrastructure/logger.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/todo_agent/infrastructure/ollama_client.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/todo_agent/infrastructure/openrouter_client.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/todo_agent/infrastructure/prompts/system_prompt.txt +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/todo_agent/infrastructure/todo_shell.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/todo_agent/infrastructure/token_counter.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/todo_agent/interface/__init__.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/todo_agent/interface/tools.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/todo_agent/main.py +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/todo_agent.egg-info/SOURCES.txt +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/todo_agent.egg-info/dependency_links.txt +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/todo_agent.egg-info/entry_points.txt +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/todo_agent.egg-info/requires.txt +0 -0
- {todo_agent-0.2.3 → todo_agent-0.2.4}/todo_agent.egg-info/top_level.txt +0 -0
@@ -14,7 +14,7 @@ class TestConversationManager:
|
|
14
14
|
"""Test ConversationManager initialization."""
|
15
15
|
manager = ConversationManager()
|
16
16
|
assert len(manager.history) == 0
|
17
|
-
assert manager.max_tokens ==
|
17
|
+
assert manager.max_tokens == 16000
|
18
18
|
assert manager.max_messages == 50
|
19
19
|
assert manager.system_prompt is None
|
20
20
|
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
28
28
|
commit_id: COMMIT_ID
|
29
29
|
__commit_id__: COMMIT_ID
|
30
30
|
|
31
|
-
__version__ = version = '0.2.
|
32
|
-
__version_tuple__ = version_tuple = (0, 2,
|
31
|
+
__version__ = version = '0.2.4'
|
32
|
+
__version_tuple__ = version_tuple = (0, 2, 4)
|
33
33
|
|
34
|
-
__commit_id__ = commit_id = '
|
34
|
+
__commit_id__ = commit_id = 'gc2b1a1313'
|
@@ -35,7 +35,7 @@ class ConversationManager:
|
|
35
35
|
"""Manages conversation state and memory for LLM interactions."""
|
36
36
|
|
37
37
|
def __init__(
|
38
|
-
self, max_tokens: int =
|
38
|
+
self, max_tokens: int = 16000, max_messages: int = 50, model: str = "gpt-4"
|
39
39
|
):
|
40
40
|
self.history: List[ConversationMessage] = []
|
41
41
|
self.max_tokens = max_tokens
|
@@ -2,6 +2,8 @@
|
|
2
2
|
Command-line interface for todo.sh LLM agent.
|
3
3
|
"""
|
4
4
|
|
5
|
+
from typing import Optional
|
6
|
+
|
5
7
|
try:
|
6
8
|
import readline
|
7
9
|
|
@@ -130,6 +132,27 @@ class CLI:
|
|
130
132
|
table = TableFormatter.create_stats_table(summary)
|
131
133
|
self.console.print(table)
|
132
134
|
|
135
|
+
def _get_memory_usage(self) -> Optional[Text]:
|
136
|
+
"""Get session memory usage as a progress bar."""
|
137
|
+
# Get conversation manager to access memory limits and current usage
|
138
|
+
conversation_manager = self.inference.get_conversation_manager()
|
139
|
+
|
140
|
+
# Get current usage from conversation summary
|
141
|
+
summary = conversation_manager.get_conversation_summary()
|
142
|
+
current_tokens = summary.get("estimated_tokens", 0)
|
143
|
+
current_messages = summary.get("total_messages", 0)
|
144
|
+
|
145
|
+
# Get limits from conversation manager
|
146
|
+
max_tokens = conversation_manager.max_tokens
|
147
|
+
max_messages = conversation_manager.max_messages
|
148
|
+
|
149
|
+
# Create memory usage bar
|
150
|
+
memory_bar = PanelFormatter.create_memory_usage_bar(
|
151
|
+
current_tokens, max_tokens, current_messages, max_messages
|
152
|
+
)
|
153
|
+
|
154
|
+
return memory_bar
|
155
|
+
|
133
156
|
def run(self) -> None:
|
134
157
|
"""Main CLI interaction loop."""
|
135
158
|
self.logger.info("Starting CLI interaction loop")
|
@@ -202,8 +225,13 @@ class CLI:
|
|
202
225
|
|
203
226
|
# Format the response and create a panel
|
204
227
|
formatted_response = ResponseFormatter.format_response(response)
|
228
|
+
|
229
|
+
# Get memory usage
|
230
|
+
memory_usage = self._get_memory_usage()
|
231
|
+
|
232
|
+
# Create response panel with memory usage
|
205
233
|
response_panel = PanelFormatter.create_response_panel(
|
206
|
-
formatted_response
|
234
|
+
formatted_response, memory_usage=memory_usage
|
207
235
|
)
|
208
236
|
self.console.print(response_panel)
|
209
237
|
|
@@ -2,11 +2,12 @@
|
|
2
2
|
Formatters for CLI output with unicode characters and consistent styling.
|
3
3
|
"""
|
4
4
|
|
5
|
-
from typing import Any, Dict
|
5
|
+
from typing import Any, Dict, Optional
|
6
6
|
|
7
7
|
from rich.align import Align
|
8
8
|
from rich.box import ROUNDED
|
9
9
|
from rich.panel import Panel
|
10
|
+
from rich.progress import Progress, SpinnerColumn, TextColumn, BarColumn, TaskProgressColumn
|
10
11
|
from rich.table import Table
|
11
12
|
from rich.text import Text
|
12
13
|
|
@@ -346,11 +347,26 @@ class PanelFormatter:
|
|
346
347
|
)
|
347
348
|
|
348
349
|
@staticmethod
|
349
|
-
def create_response_panel(content: str, title: str = "🤖 Assistant") -> Panel:
|
350
|
+
def create_response_panel(content: str, title: str = "🤖 Assistant", memory_usage: Optional[Text] = None) -> Panel:
|
350
351
|
"""Create a panel for displaying LLM responses."""
|
351
|
-
|
352
|
-
content
|
353
|
-
|
352
|
+
if memory_usage:
|
353
|
+
# Create the combined content with centered memory usage
|
354
|
+
return Panel(
|
355
|
+
Align.center(
|
356
|
+
Text.assemble(
|
357
|
+
content,
|
358
|
+
"\n\n",
|
359
|
+
"─" * (PANEL_WIDTH - 4), # Separator line
|
360
|
+
"\n",
|
361
|
+
memory_usage
|
362
|
+
)
|
363
|
+
),
|
364
|
+
title=title, border_style="dim", box=ROUNDED, width=PANEL_WIDTH
|
365
|
+
)
|
366
|
+
else:
|
367
|
+
return Panel(
|
368
|
+
content, title=title, border_style="dim", box=ROUNDED, width=PANEL_WIDTH
|
369
|
+
)
|
354
370
|
|
355
371
|
@staticmethod
|
356
372
|
def create_error_panel(content: str, title: str = "❌ Error") -> Panel:
|
@@ -397,3 +413,45 @@ class PanelFormatter:
|
|
397
413
|
box=ROUNDED,
|
398
414
|
width=PANEL_WIDTH + 2,
|
399
415
|
)
|
416
|
+
|
417
|
+
@staticmethod
|
418
|
+
def create_memory_usage_bar(current_tokens: int, max_tokens: int, current_messages: int, max_messages: int) -> Text:
|
419
|
+
"""
|
420
|
+
Create a rich progress bar showing session memory usage.
|
421
|
+
|
422
|
+
Args:
|
423
|
+
current_tokens: Current number of tokens in conversation
|
424
|
+
max_tokens: Maximum allowed tokens
|
425
|
+
current_messages: Current number of messages in conversation
|
426
|
+
max_messages: Maximum allowed messages
|
427
|
+
|
428
|
+
Returns:
|
429
|
+
Rich Text object with memory usage progress bar
|
430
|
+
"""
|
431
|
+
# Calculate percentage
|
432
|
+
token_percentage = min(100, (current_tokens / max_tokens) * 100)
|
433
|
+
|
434
|
+
# Determine color based on usage
|
435
|
+
if token_percentage >= 90:
|
436
|
+
color = "red"
|
437
|
+
elif token_percentage >= 75:
|
438
|
+
color = "yellow"
|
439
|
+
else:
|
440
|
+
color = "green"
|
441
|
+
|
442
|
+
# Create the progress bar text
|
443
|
+
memory_text = Text()
|
444
|
+
memory_text.append(f"{current_tokens:,}/{max_tokens:,} ", style="dim")
|
445
|
+
|
446
|
+
# Create a simple text-based progress bar
|
447
|
+
bar_length = 25
|
448
|
+
token_filled = int((token_percentage / 100) * bar_length)
|
449
|
+
token_bar = "█" * token_filled + "░" * (bar_length - token_filled)
|
450
|
+
memory_text.append(f"[{token_bar}] ", style="dim")
|
451
|
+
memory_text.append(f"{token_percentage:.1f}%", style="dim")
|
452
|
+
|
453
|
+
# Add message count without progress bar
|
454
|
+
memory_text.append(" | ", style="dim")
|
455
|
+
memory_text.append(f"{current_messages}/{max_messages}", style="dim")
|
456
|
+
|
457
|
+
return memory_text
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|