code-puppy 0.0.145__py3-none-any.whl → 0.0.146__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/agent.py CHANGED
@@ -193,8 +193,9 @@ def get_code_generation_agent(force_reload=False, message_group: str | None = No
193
193
 
194
194
  def get_custom_usage_limits():
195
195
  """
196
- Returns custom usage limits with increased request limit of 100 requests per minute.
196
+ Returns custom usage limits with configurable request limit.
197
197
  This centralizes the configuration of rate limiting for the agent.
198
- Default pydantic-ai limit is 50, this increases it to 100.
198
+ Default pydantic-ai limit is 50, this increases it to the configured value (default 100).
199
199
  """
200
- return UsageLimits(request_limit=100)
200
+ from code_puppy.config import get_message_limit
201
+ return UsageLimits(request_limit=get_message_limit())
@@ -17,7 +17,7 @@ META_COMMANDS_HELP = """
17
17
  ~m <model> Set active model
18
18
  ~motd Show the latest message of the day (MOTD)
19
19
  ~show Show puppy config key-values
20
- ~set Set puppy config key-values
20
+ ~set Set puppy config key-values (message_limit, protected_token_count, compaction_threshold, etc.)
21
21
  ~<unknown> Show unknown meta command warning
22
22
  """
23
23
 
@@ -62,21 +62,21 @@ def handle_meta_command(command: str, console: Console) -> bool:
62
62
  get_owner_name,
63
63
  get_puppy_name,
64
64
  get_yolo_mode,
65
- get_message_history_limit,
65
+ get_message_limit,
66
66
  )
67
67
 
68
68
  puppy_name = get_puppy_name()
69
69
  owner_name = get_owner_name()
70
70
  model = get_active_model()
71
71
  yolo_mode = get_yolo_mode()
72
- msg_limit = get_message_history_limit()
72
+ msg_limit = get_message_limit()
73
73
  console.print(f"""[bold magenta]🐶 Puppy Status[/bold magenta]
74
74
 
75
75
  [bold]puppy_name:[/bold] [cyan]{puppy_name}[/cyan]
76
76
  [bold]owner_name:[/bold] [cyan]{owner_name}[/cyan]
77
77
  [bold]model:[/bold] [green]{model}[/green]
78
78
  [bold]YOLO_MODE:[/bold] {"[red]ON[/red]" if yolo_mode else "[yellow]off[/yellow]"}
79
- [bold]message_history_limit:[/bold] Keeping last [cyan]{msg_limit}[/cyan] messages in context
79
+ [bold]message_limit:[/bold] [cyan]{msg_limit}[/cyan] requests per minute
80
80
  """)
81
81
  return True
82
82
 
code_puppy/config.py CHANGED
@@ -93,9 +93,9 @@ def get_model_context_length() -> int:
93
93
  def get_config_keys():
94
94
  """
95
95
  Returns the list of all config keys currently in puppy.cfg,
96
- plus certain preset expected keys (e.g. "yolo_mode", "model", "compaction_strategy").
96
+ plus certain preset expected keys (e.g. "yolo_mode", "model", "compaction_strategy", "message_limit").
97
97
  """
98
- default_keys = ["yolo_mode", "model", "compaction_strategy"]
98
+ default_keys = ["yolo_mode", "model", "compaction_strategy", "message_limit"]
99
99
  config = configparser.ConfigParser()
100
100
  config.read(CONFIG_FILE)
101
101
  keys = set(config[DEFAULT_SECTION].keys()) if DEFAULT_SECTION in config else set()
@@ -435,6 +435,20 @@ def get_compaction_strategy() -> str:
435
435
  return "truncation"
436
436
 
437
437
 
438
+ def get_message_limit(default: int = 100) -> int:
439
+ """
440
+ Returns the user-configured message/request limit for the agent.
441
+ This controls how many steps/requests the agent can take.
442
+ Defaults to 100 if unset or misconfigured.
443
+ Configurable by 'message_limit' key.
444
+ """
445
+ val = get_value("message_limit")
446
+ try:
447
+ return int(val) if val else default
448
+ except (ValueError, TypeError):
449
+ return default
450
+
451
+
438
452
  def save_command_to_history(command: str):
439
453
  """Save a command to the history file with an ISO format timestamp.
440
454
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: code-puppy
3
- Version: 0.0.145
3
+ Version: 0.0.146
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
@@ -1,8 +1,8 @@
1
1
  code_puppy/__init__.py,sha256=ehbM1-wMjNmOXk_DBhhJECFyBv2dRHwwo7ucjHeM68E,107
2
2
  code_puppy/__main__.py,sha256=pDVssJOWP8A83iFkxMLY9YteHYat0EyWDQqMkKHpWp4,203
3
- code_puppy/agent.py,sha256=ZQb1YWvBJXzGzXML1wI4gPf_-2kClMrYFleFMtA-9RA,6925
3
+ code_puppy/agent.py,sha256=3pbcyM_WjY4OsOYtWxfglpcnD7H8TxUJLNFELVMgJcA,7000
4
4
  code_puppy/callbacks.py,sha256=6wYB6K_fGSCkKKEFaYOYkJT45WaV5W_NhUIzcvVH_nU,5060
5
- code_puppy/config.py,sha256=9yWKHKjLJ2Ddl4frrBI9VRIwPvoWpIx1fAd1YpAvOSQ,15330
5
+ code_puppy/config.py,sha256=n4Em_txe-mz5UVTyCO2OQe4JzX2yUyVG7WT3NdvOVbU,15800
6
6
  code_puppy/http_utils.py,sha256=BAvt4hed7fVMXglA7eS9gOb08h2YTuOyai6VmQq09fg,3432
7
7
  code_puppy/main.py,sha256=Vv5HSJnkgZhCvvOoXrJ2zqM5P-i47-RcYAU00Z1Pfx0,21733
8
8
  code_puppy/message_history_processor.py,sha256=O2rKp7W6YeIg93W8b0XySTUEQgIZm0f_06--_kzHugM,16145
@@ -27,7 +27,7 @@ code_puppy/command_line/__init__.py,sha256=y7WeRemfYppk8KVbCGeAIiTuiOszIURCDjOMZ
27
27
  code_puppy/command_line/command_handler.py,sha256=1o9tKAGycpHFDBldYRAAvY5HJ6QAfikLPrXTEkfw37o,21137
28
28
  code_puppy/command_line/file_path_completion.py,sha256=gw8NpIxa6GOpczUJRyh7VNZwoXKKn-yvCqit7h2y6Gg,2931
29
29
  code_puppy/command_line/load_context_completion.py,sha256=6eZxV6Bs-EFwZjN93V8ZDZUC-6RaWxvtZk-04Wtikyw,2240
30
- code_puppy/command_line/meta_command_handler.py,sha256=02NU4Lspf5qRMPTsrGiMRLSUshZhdmS0XQA26k8vUjw,5665
30
+ code_puppy/command_line/meta_command_handler.py,sha256=xWa3_V1xQPi25V86eaTXa3NXPT3ygiKACb50uuy6TiM,5695
31
31
  code_puppy/command_line/model_picker_completion.py,sha256=adxp3NZaDV67YqaGv0SG7WVvOTXN0UwkkLqxTsknAvs,4126
32
32
  code_puppy/command_line/motd.py,sha256=PEdkp3ZnydVfvd7mNJylm8YyFNUKg9jmY6uwkA1em8c,2152
33
33
  code_puppy/command_line/prompt_toolkit_completion.py,sha256=vmsA0F4TfXZ3gjVzCfSNM3TIY-w3z_fSteTCcia2zAU,9379
@@ -126,9 +126,9 @@ code_puppy/tui/tests/test_sidebar_history_navigation.py,sha256=JGiyua8A2B8dLfwiE
126
126
  code_puppy/tui/tests/test_status_bar.py,sha256=nYT_FZGdmqnnbn6o0ZuOkLtNUtJzLSmtX8P72liQ5Vo,1797
127
127
  code_puppy/tui/tests/test_timestamped_history.py,sha256=nVXt9hExZZ_8MFP-AZj4L4bB_1Eo_mc-ZhVICzTuw3I,1799
128
128
  code_puppy/tui/tests/test_tools.py,sha256=kgzzAkK4r0DPzQwHHD4cePpVNgrHor6cFr05Pg6DBWg,2687
129
- code_puppy-0.0.145.data/data/code_puppy/models.json,sha256=dAfpMMI2EEeOMv0ynHSmMuJAYDLcZrs5gCLX3voC4-A,3252
130
- code_puppy-0.0.145.dist-info/METADATA,sha256=i8WX2P4dcHB7_rGZGug23IafcwjtNPYsy1rcSbsKm9o,22019
131
- code_puppy-0.0.145.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
132
- code_puppy-0.0.145.dist-info/entry_points.txt,sha256=d8YkBvIUxF-dHNJAj-x4fPEqizbY5d_TwvYpc01U5kw,58
133
- code_puppy-0.0.145.dist-info/licenses/LICENSE,sha256=31u8x0SPgdOq3izJX41kgFazWsM43zPEF9eskzqbJMY,1075
134
- code_puppy-0.0.145.dist-info/RECORD,,
129
+ code_puppy-0.0.146.data/data/code_puppy/models.json,sha256=dAfpMMI2EEeOMv0ynHSmMuJAYDLcZrs5gCLX3voC4-A,3252
130
+ code_puppy-0.0.146.dist-info/METADATA,sha256=wciu-hCWux40BXIFeOy3xtNnZ66bebBHJYMOU9AgQHs,22019
131
+ code_puppy-0.0.146.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
132
+ code_puppy-0.0.146.dist-info/entry_points.txt,sha256=d8YkBvIUxF-dHNJAj-x4fPEqizbY5d_TwvYpc01U5kw,58
133
+ code_puppy-0.0.146.dist-info/licenses/LICENSE,sha256=31u8x0SPgdOq3izJX41kgFazWsM43zPEF9eskzqbJMY,1075
134
+ code_puppy-0.0.146.dist-info/RECORD,,