code-puppy 0.0.167__py3-none-any.whl → 0.0.169__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.
@@ -79,6 +79,10 @@ def get_commands_help():
79
79
  Text("/tools", style="cyan")
80
80
  + Text(" Show available tools and capabilities")
81
81
  )
82
+ help_lines.append(
83
+ Text("/truncate", style="cyan")
84
+ + Text(" <N> Truncate message history to N most recent messages (keeping system message)")
85
+ )
82
86
  help_lines.append(
83
87
  Text("/<unknown>", style="cyan")
84
88
  + Text(" Show unknown command warning")
@@ -615,6 +619,39 @@ def handle_command(command: str):
615
619
  emit_error(f"Failed to load context: {e}")
616
620
  return True
617
621
 
622
+ if command.startswith("/truncate"):
623
+ tokens = command.split()
624
+ if len(tokens) != 2:
625
+ emit_error("Usage: /truncate <N> (where N is the number of messages to keep)")
626
+ return True
627
+
628
+ try:
629
+ n = int(tokens[1])
630
+ if n < 1:
631
+ emit_error("N must be a positive integer")
632
+ return True
633
+ except ValueError:
634
+ emit_error("N must be a valid integer")
635
+ return True
636
+
637
+ from code_puppy.state_management import get_message_history, set_message_history
638
+
639
+ history = get_message_history()
640
+ if not history:
641
+ emit_warning("No history to truncate yet. Ask me something first!")
642
+ return True
643
+
644
+ if len(history) <= n:
645
+ emit_info(f"History already has {len(history)} messages, which is <= {n}. Nothing to truncate.")
646
+ return True
647
+
648
+ # Always keep the first message (system message) and then keep the N-1 most recent messages
649
+ truncated_history = [history[0]] + history[-(n-1):] if n > 1 else [history[0]]
650
+
651
+ set_message_history(truncated_history)
652
+ emit_success(f"Truncated message history from {len(history)} to {len(truncated_history)} messages (keeping system message and {n-1} most recent)")
653
+ return True
654
+
618
655
  if command in ("/exit", "/quit"):
619
656
  emit_success("Goodbye!")
620
657
  # Signal to the main app that we want to exit
code_puppy/http_utils.py CHANGED
@@ -70,7 +70,7 @@ def create_client(
70
70
  fallback_strategy=wait_exponential(multiplier=1, max=60),
71
71
  max_wait=300
72
72
  ),
73
- stop=stop_after_attempt(5),
73
+ stop=stop_after_attempt(10),
74
74
  reraise=True
75
75
  ),
76
76
  validate_response=should_retry_status
@@ -106,7 +106,7 @@ def create_async_client(
106
106
  fallback_strategy=wait_exponential(multiplier=1, max=60),
107
107
  max_wait=300
108
108
  ),
109
- stop=stop_after_attempt(5),
109
+ stop=stop_after_attempt(10),
110
110
  reraise=True
111
111
  ),
112
112
  validate_response=should_retry_status
@@ -182,7 +182,7 @@ def create_reopenable_async_client(
182
182
  fallback_strategy=wait_exponential(multiplier=1, max=60),
183
183
  max_wait=300
184
184
  ),
185
- stop=stop_after_attempt(5),
185
+ stop=stop_after_attempt(10),
186
186
  reraise=True
187
187
  ),
188
188
  validate_response=should_retry_status
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: code-puppy
3
- Version: 0.0.167
3
+ Version: 0.0.169
4
4
  Summary: Code generation agent
5
5
  Project-URL: repository, https://github.com/mpfaffenberger/code_puppy
6
6
  Project-URL: HomePage, https://github.com/mpfaffenberger/code_puppy
@@ -211,6 +211,18 @@ Switches to the specified agent
211
211
  ```
212
212
  Switches to the Agent Creator for building custom agents
213
213
 
214
+ ### Truncate Message History
215
+ ```bash
216
+ /truncate <N>
217
+ ```
218
+ Truncates the message history to keep only the N most recent messages while protecting the first (system) message. For example:
219
+ ```bash
220
+ /truncate 20
221
+ ```
222
+ Would keep the system message plus the 19 most recent messages, removing older ones from the history.
223
+
224
+ This is useful for managing context length when you have a long conversation history but only need the most recent interactions.
225
+
214
226
  ## Available Agents
215
227
 
216
228
  ### Code-Puppy 🐶 (Default)
@@ -3,7 +3,7 @@ code_puppy/__main__.py,sha256=pDVssJOWP8A83iFkxMLY9YteHYat0EyWDQqMkKHpWp4,203
3
3
  code_puppy/agent.py,sha256=wCARhq7PcD38c4l83fuXm4Us_6c1TXVa0U7TnBnNPEY,8064
4
4
  code_puppy/callbacks.py,sha256=6wYB6K_fGSCkKKEFaYOYkJT45WaV5W_NhUIzcvVH_nU,5060
5
5
  code_puppy/config.py,sha256=J8XU0iOPtfzrkDD49b4TdrdHoQmW2kaP-25PPbGGdKU,16386
6
- code_puppy/http_utils.py,sha256=JecBdukr9dr1xcjw-Zyx2iD65RDEd183r8e1NMU4HLo,8093
6
+ code_puppy/http_utils.py,sha256=XJ1ItAW3I4zdJNzybV17Z8Y58NoFyAJEjUg7I69SXlw,8096
7
7
  code_puppy/main.py,sha256=tYLfhUjPTJ-4S1r-pr-jSbn6kIU1iYvt2Z8lxI7zDFY,22220
8
8
  code_puppy/message_history_processor.py,sha256=zzeOSUC1Wpsry-z2MD6pQWk2wt1axGSOKaGR2v22_qQ,18825
9
9
  code_puppy/model_factory.py,sha256=z9vQbcGllgMwU0On8rPvzYxkygW2Uyd3NJmRzbKv-is,13759
@@ -23,7 +23,7 @@ code_puppy/agents/base_agent.py,sha256=XYSff6IQX9Z6C7hPVbN_YXC2xfjwd268e2jtG3ZGn
23
23
  code_puppy/agents/json_agent.py,sha256=y6AYE3Fx9LhmemcPzt46d7359MNnkGIjU83YBGNer2g,4533
24
24
  code_puppy/agents/runtime_manager.py,sha256=fUOBpmETo3wTyLc5wWBfGKSX1HFRQWSpuwxYAOyA-_8,10059
25
25
  code_puppy/command_line/__init__.py,sha256=y7WeRemfYppk8KVbCGeAIiTuiOszIURCDjOMZv_YRmU,45
26
- code_puppy/command_line/command_handler.py,sha256=gdsOR04CIkUQjSMJtvrKDdAQNe6cF8JcsTObN-XfTLE,24414
26
+ code_puppy/command_line/command_handler.py,sha256=Owf5ZFipN25XTy_wNrw7nOb22T0D0WVRxnGdB3A-4Cs,25960
27
27
  code_puppy/command_line/file_path_completion.py,sha256=gw8NpIxa6GOpczUJRyh7VNZwoXKKn-yvCqit7h2y6Gg,2931
28
28
  code_puppy/command_line/load_context_completion.py,sha256=6eZxV6Bs-EFwZjN93V8ZDZUC-6RaWxvtZk-04Wtikyw,2240
29
29
  code_puppy/command_line/meta_command_handler.py,sha256=80aK5JQOaqjt149qBmSsM02uy2Cikkee8zaQnu5u2KQ,5712
@@ -104,9 +104,9 @@ code_puppy/tui/screens/help.py,sha256=eJuPaOOCp7ZSUlecearqsuX6caxWv7NQszUh0tZJjB
104
104
  code_puppy/tui/screens/mcp_install_wizard.py,sha256=xqwN5omltMkfxWZwXj3D2PbXbtrxUi1dT0XT77oxOKk,27685
105
105
  code_puppy/tui/screens/settings.py,sha256=GMpv-qa08rorAE9mj3AjmqjZFPhmeJ_GWd-DBHG6iAA,10671
106
106
  code_puppy/tui/screens/tools.py,sha256=3pr2Xkpa9Js6Yhf1A3_wQVRzFOui-KDB82LwrsdBtyk,1715
107
- code_puppy-0.0.167.data/data/code_puppy/models.json,sha256=iXmLZGflnQcu2DRh4WUlgAhoXdvoxUc7KBhB8YxawXM,3088
108
- code_puppy-0.0.167.dist-info/METADATA,sha256=kmno03NP1H0J8qL2UAKHSq200Bsv1XkwCk9GqfwsrXg,19598
109
- code_puppy-0.0.167.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
110
- code_puppy-0.0.167.dist-info/entry_points.txt,sha256=d8YkBvIUxF-dHNJAj-x4fPEqizbY5d_TwvYpc01U5kw,58
111
- code_puppy-0.0.167.dist-info/licenses/LICENSE,sha256=31u8x0SPgdOq3izJX41kgFazWsM43zPEF9eskzqbJMY,1075
112
- code_puppy-0.0.167.dist-info/RECORD,,
107
+ code_puppy-0.0.169.data/data/code_puppy/models.json,sha256=iXmLZGflnQcu2DRh4WUlgAhoXdvoxUc7KBhB8YxawXM,3088
108
+ code_puppy-0.0.169.dist-info/METADATA,sha256=-cW4srdgLTHw8gOC4LFKiZ6RjmO9SQVKRHnp8vl8N3s,20039
109
+ code_puppy-0.0.169.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
110
+ code_puppy-0.0.169.dist-info/entry_points.txt,sha256=d8YkBvIUxF-dHNJAj-x4fPEqizbY5d_TwvYpc01U5kw,58
111
+ code_puppy-0.0.169.dist-info/licenses/LICENSE,sha256=31u8x0SPgdOq3izJX41kgFazWsM43zPEF9eskzqbJMY,1075
112
+ code_puppy-0.0.169.dist-info/RECORD,,