todo-agent 0.2.3__py3-none-any.whl → 0.2.4__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.
todo_agent/_version.py CHANGED
@@ -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.3'
32
- __version_tuple__ = version_tuple = (0, 2, 3)
31
+ __version__ = version = '0.2.4'
32
+ __version_tuple__ = version_tuple = (0, 2, 4)
33
33
 
34
34
  __commit_id__ = commit_id = None
@@ -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 = 4000, max_messages: int = 50, model: str = "gpt-4"
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
- return Panel(
352
- content, title=title, border_style="dim", box=ROUNDED, width=PANEL_WIDTH
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: todo-agent
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: A natural language interface for todo.sh task management
5
5
  Author: codeprimate
6
6
  Maintainer: codeprimate
@@ -1,8 +1,8 @@
1
1
  todo_agent/__init__.py,sha256=RUowhd14r3tqB_7rl83unGV8oBjra3UOIl7jix-33fk,254
2
- todo_agent/_version.py,sha256=kBRz0P2plw1eVdIpt70W6m1LMbEIhLY3RyOfVGdubaI,704
2
+ todo_agent/_version.py,sha256=NRw4Jle4n9v_DD2wtplRqflGCvX8OU5eAjycYY0vY3Y,704
3
3
  todo_agent/main.py,sha256=-ryhMm4c4sz4e4anXI8B-CYnpEh5HIkmnYcnGxcWHDk,1628
4
4
  todo_agent/core/__init__.py,sha256=QAZ4it63pXv5-DxtNcuSAmg7ZnCY5ackI5yycvKHr9I,365
5
- todo_agent/core/conversation_manager.py,sha256=Mxjxn3BTjSnju6xryQcpOWdE8wWWJqTdDFTC86D9xc8,11639
5
+ todo_agent/core/conversation_manager.py,sha256=gSCcX356UJ0T3FCTS1q0fOud0ytFKXptf9RyKjzpTYI,11640
6
6
  todo_agent/core/exceptions.py,sha256=cPvvkIbKdI7l51wC7cE-ZxUi54P3nf2m7x2lMNMRFYM,399
7
7
  todo_agent/core/todo_manager.py,sha256=wV-J_E_aK7yRNT-WbILKJgqBFhbcXDZa6Pb4IjbgGkU,7974
8
8
  todo_agent/infrastructure/__init__.py,sha256=SGbHXgzq6U1DMgOfWPMsWEK99zjPSF-6gzy7xqc5fsI,284
@@ -17,12 +17,12 @@ todo_agent/infrastructure/todo_shell.py,sha256=z6kqUKDX-i4DfYJKoOLiPLCp8y6m1HdTD
17
17
  todo_agent/infrastructure/token_counter.py,sha256=PCKheOVJbp1s89yhh_i6iKgURMt9mVoYkwjQJCc2xCE,4958
18
18
  todo_agent/infrastructure/prompts/system_prompt.txt,sha256=uCb6yz3uDQdwcB8HJcF0y1_1b75oRtRnCMMHQLHI3NI,2415
19
19
  todo_agent/interface/__init__.py,sha256=vDD3rQu4qDkpvVwGVtkDzE1M4IiSHYzTif4GbYSFWaI,457
20
- todo_agent/interface/cli.py,sha256=audxpDafLw_o-pitqntUN0PpKUyWZap2wpHw4QUak_8,9926
21
- todo_agent/interface/formatters.py,sha256=aJc-a2aUzi3tId46jFK3uwZnsOJiXBTTMT8I_46Jjlg,13181
20
+ todo_agent/interface/cli.py,sha256=FacwTDjLP60qAQ_BsM_7_jM9liYJpZpRdXpBNwNuO2Y,11060
21
+ todo_agent/interface/formatters.py,sha256=QT6IgBVX6ghL8UWH54KFtJY9n9GbrPvOizjCN8emMGg,15503
22
22
  todo_agent/interface/tools.py,sha256=mlPPLVwECYrTtOX8ysIORRfErIOJl43qlTvfdpy2Vbs,28559
23
- todo_agent-0.2.3.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
24
- todo_agent-0.2.3.dist-info/METADATA,sha256=VvqQLIc4ExA92Oa-nhukv96wszxQnYSf7nlG09hiZt0,10047
25
- todo_agent-0.2.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
26
- todo_agent-0.2.3.dist-info/entry_points.txt,sha256=4W7LrCib6AXP5IZDwWRht8S5gutLu5oNfTJHGbt4oHs,52
27
- todo_agent-0.2.3.dist-info/top_level.txt,sha256=a65mlPIhPZHuq2bRIi_sCMAIJsUddvXt171OBF6r6co,11
28
- todo_agent-0.2.3.dist-info/RECORD,,
23
+ todo_agent-0.2.4.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
24
+ todo_agent-0.2.4.dist-info/METADATA,sha256=fYnY58TYzNuQtiu2WBr3fRJwJEIh6bbt4gA2lrNC_9A,10047
25
+ todo_agent-0.2.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
26
+ todo_agent-0.2.4.dist-info/entry_points.txt,sha256=4W7LrCib6AXP5IZDwWRht8S5gutLu5oNfTJHGbt4oHs,52
27
+ todo_agent-0.2.4.dist-info/top_level.txt,sha256=a65mlPIhPZHuq2bRIi_sCMAIJsUddvXt171OBF6r6co,11
28
+ todo_agent-0.2.4.dist-info/RECORD,,