code-puppy 0.0.167__py3-none-any.whl → 0.0.168__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.
- code_puppy/command_line/command_handler.py +37 -0
- {code_puppy-0.0.167.dist-info → code_puppy-0.0.168.dist-info}/METADATA +13 -1
- {code_puppy-0.0.167.dist-info → code_puppy-0.0.168.dist-info}/RECORD +7 -7
- {code_puppy-0.0.167.data → code_puppy-0.0.168.data}/data/code_puppy/models.json +0 -0
- {code_puppy-0.0.167.dist-info → code_puppy-0.0.168.dist-info}/WHEEL +0 -0
- {code_puppy-0.0.167.dist-info → code_puppy-0.0.168.dist-info}/entry_points.txt +0 -0
- {code_puppy-0.0.167.dist-info → code_puppy-0.0.168.dist-info}/licenses/LICENSE +0 -0
|
@@ -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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: code-puppy
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.168
|
|
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)
|
|
@@ -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=
|
|
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.
|
|
108
|
-
code_puppy-0.0.
|
|
109
|
-
code_puppy-0.0.
|
|
110
|
-
code_puppy-0.0.
|
|
111
|
-
code_puppy-0.0.
|
|
112
|
-
code_puppy-0.0.
|
|
107
|
+
code_puppy-0.0.168.data/data/code_puppy/models.json,sha256=iXmLZGflnQcu2DRh4WUlgAhoXdvoxUc7KBhB8YxawXM,3088
|
|
108
|
+
code_puppy-0.0.168.dist-info/METADATA,sha256=aimCiEFEJFvlfzgQSEHndWt5YWWOlw5uPcdlzludXPE,20039
|
|
109
|
+
code_puppy-0.0.168.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
110
|
+
code_puppy-0.0.168.dist-info/entry_points.txt,sha256=d8YkBvIUxF-dHNJAj-x4fPEqizbY5d_TwvYpc01U5kw,58
|
|
111
|
+
code_puppy-0.0.168.dist-info/licenses/LICENSE,sha256=31u8x0SPgdOq3izJX41kgFazWsM43zPEF9eskzqbJMY,1075
|
|
112
|
+
code_puppy-0.0.168.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|