code-puppy 0.0.362__py3-none-any.whl → 0.0.363__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.
@@ -6,6 +6,7 @@ with live preview of agent details.
6
6
 
7
7
  import sys
8
8
  import time
9
+ import unicodedata
9
10
  from typing import List, Optional, Tuple
10
11
 
11
12
  from prompt_toolkit.application import Application
@@ -24,6 +25,30 @@ from code_puppy.tools.command_runner import set_awaiting_user_input
24
25
  PAGE_SIZE = 10 # Agents per page
25
26
 
26
27
 
28
+ def _sanitize_display_text(text: str) -> str:
29
+ """Remove or replace characters that cause terminal rendering issues.
30
+
31
+ Args:
32
+ text: Text that may contain emojis or wide characters
33
+
34
+ Returns:
35
+ Sanitized text safe for prompt_toolkit rendering
36
+ """
37
+ # Keep only characters that render cleanly in terminals
38
+ result = []
39
+ for char in text:
40
+ # Get unicode category
41
+ cat = unicodedata.category(char)
42
+ # Keep letters, numbers, punctuation, spaces, and common symbols
43
+ # Skip "So" (Symbol, other - includes most emojis) that cause issues
44
+ if cat != "So" and cat != "Cn": # Cn = not assigned
45
+ result.append(char)
46
+ # Optionally, you could replace emojis with a placeholder:
47
+ # else:
48
+ # result.append("*")
49
+ return "".join(result).strip()
50
+
51
+
27
52
  def _get_agent_entries() -> List[Tuple[str, str, str]]:
28
53
  """Get all agents with their display names and descriptions.
29
54
 
@@ -65,7 +90,7 @@ def _render_menu_panel(
65
90
  start_idx = page * PAGE_SIZE
66
91
  end_idx = min(start_idx + PAGE_SIZE, len(entries))
67
92
 
68
- lines.append(("bold", " Agents"))
93
+ lines.append(("bold", "Agents"))
69
94
  lines.append(("fg:ansibrightblack", f" (Page {page + 1}/{total_pages})"))
70
95
  lines.append(("", "\n\n"))
71
96
 
@@ -78,14 +103,17 @@ def _render_menu_panel(
78
103
  name, display_name, _ = entries[i]
79
104
  is_selected = i == selected_idx
80
105
  is_current = name == current_agent_name
106
+
107
+ # Sanitize display name to avoid emoji rendering issues
108
+ safe_display_name = _sanitize_display_text(display_name)
81
109
 
82
110
  # Build the line
83
111
  if is_selected:
84
- lines.append(("fg:ansigreen", " ▶ "))
85
- lines.append(("fg:ansigreen bold", display_name))
112
+ lines.append(("fg:ansigreen", "▶ "))
113
+ lines.append(("fg:ansigreen bold", safe_display_name))
86
114
  else:
87
- lines.append(("", " "))
88
- lines.append(("", display_name))
115
+ lines.append(("", " "))
116
+ lines.append(("", safe_display_name))
89
117
 
90
118
  # Add current marker
91
119
  if is_current:
@@ -132,35 +160,39 @@ def _render_preview_panel(
132
160
 
133
161
  name, display_name, description = entry
134
162
  is_current = name == current_agent_name
163
+
164
+ # Sanitize text to avoid emoji rendering issues
165
+ safe_display_name = _sanitize_display_text(display_name)
166
+ safe_description = _sanitize_display_text(description)
135
167
 
136
168
  # Agent name (identifier)
137
- lines.append(("bold", " Name: "))
169
+ lines.append(("bold", "Name: "))
138
170
  lines.append(("", name))
139
171
  lines.append(("", "\n\n"))
140
172
 
141
173
  # Display name
142
- lines.append(("bold", " Display Name: "))
143
- lines.append(("fg:ansicyan", display_name))
174
+ lines.append(("bold", "Display Name: "))
175
+ lines.append(("fg:ansicyan", safe_display_name))
144
176
  lines.append(("", "\n\n"))
145
177
 
146
178
  # Description
147
- lines.append(("bold", " Description:"))
179
+ lines.append(("bold", "Description:"))
148
180
  lines.append(("", "\n"))
149
181
 
150
182
  # Wrap description to fit panel
151
- desc_lines = description.split("\n")
183
+ desc_lines = safe_description.split("\n")
152
184
  for desc_line in desc_lines:
153
185
  # Word wrap long lines
154
186
  words = desc_line.split()
155
- current_line = " "
187
+ current_line = ""
156
188
  for word in words:
157
- if len(current_line) + len(word) + 1 > 60:
189
+ if len(current_line) + len(word) + 1 > 55:
158
190
  lines.append(("fg:ansibrightblack", current_line))
159
191
  lines.append(("", "\n"))
160
- current_line = " " + word
192
+ current_line = word
161
193
  else:
162
- if current_line == " ":
163
- current_line += word
194
+ if current_line == "":
195
+ current_line = word
164
196
  else:
165
197
  current_line += " " + word
166
198
  if current_line.strip():
@@ -222,10 +254,10 @@ async def interactive_agent_picker() -> Optional[str]:
222
254
  )
223
255
 
224
256
  menu_window = Window(
225
- content=menu_control, wrap_lines=True, width=Dimension(weight=35)
257
+ content=menu_control, wrap_lines=False, width=Dimension(weight=35)
226
258
  )
227
259
  preview_window = Window(
228
- content=preview_control, wrap_lines=True, width=Dimension(weight=65)
260
+ content=preview_control, wrap_lines=False, width=Dimension(weight=65)
229
261
  )
230
262
 
231
263
  menu_frame = Frame(menu_window, width=Dimension(weight=35), title="Agents")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: code-puppy
3
- Version: 0.0.362
3
+ Version: 0.0.363
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
@@ -67,7 +67,7 @@ code_puppy/api/routers/sessions.py,sha256=GqYRT7IJYPpEdTseLF3FIpbvvD86lIqwwPswL3
67
67
  code_puppy/api/templates/terminal.html,sha256=9alh6tTbLyXPDjBvkXw8nEWPXB-m_LIceGGRYpSLuyo,13125
68
68
  code_puppy/command_line/__init__.py,sha256=y7WeRemfYppk8KVbCGeAIiTuiOszIURCDjOMZv_YRmU,45
69
69
  code_puppy/command_line/add_model_menu.py,sha256=CpURhxPvUhLHLBV_uwH1ODfJ-WAcGklvlsjEf5Vfvg4,43255
70
- code_puppy/command_line/agent_menu.py,sha256=A63k3jkr9htUmzR4v2ORWcyO-COzvbTwaIgDz_AnVK8,9468
70
+ code_puppy/command_line/agent_menu.py,sha256=4tWtD6-2j3MSbWi0XSuBOVIXk_S6tJwys1sxsBf6Qus,10665
71
71
  code_puppy/command_line/attachments.py,sha256=4Q5I2Es4j0ltnz5wjw2z0QXMsiMJvEfWRkPf_lJeITM,13093
72
72
  code_puppy/command_line/autosave_menu.py,sha256=de7nOmFmEH6x5T7C95U8N8xgxxeF-l5lgaJzGJsF3ZY,19824
73
73
  code_puppy/command_line/clipboard.py,sha256=oe9bfAX5RnT81FiYrDmhvHaePS1tAT-NFG1fSXubSD4,16869
@@ -207,10 +207,10 @@ code_puppy/tools/browser/chromium_terminal_manager.py,sha256=w1thQ_ACb6oV45L93TS
207
207
  code_puppy/tools/browser/terminal_command_tools.py,sha256=9byOZku-dwvTtCl532xt7Lumed_jTn0sLvUe_X75XCQ,19068
208
208
  code_puppy/tools/browser/terminal_screenshot_tools.py,sha256=J_21YO_495NvYgNFu9KQP6VYg2K_f8CtSdZuF94Yhnw,18448
209
209
  code_puppy/tools/browser/terminal_tools.py,sha256=F5LjVH3udSCFHmqC3O1UJLoLozZFZsEdX42jOmkqkW0,17853
210
- code_puppy-0.0.362.data/data/code_puppy/models.json,sha256=FMQdE_yvP_8y0xxt3K918UkFL9cZMYAqW1SfXcQkU_k,3105
211
- code_puppy-0.0.362.data/data/code_puppy/models_dev_api.json,sha256=wHjkj-IM_fx1oHki6-GqtOoCrRMR0ScK0f-Iz0UEcy8,548187
212
- code_puppy-0.0.362.dist-info/METADATA,sha256=3o2P9erqXHD7H0pAfDy_DTolwLVEkDatTTPDzHS2hY8,27614
213
- code_puppy-0.0.362.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
214
- code_puppy-0.0.362.dist-info/entry_points.txt,sha256=Tp4eQC99WY3HOKd3sdvb22vZODRq0XkZVNpXOag_KdI,91
215
- code_puppy-0.0.362.dist-info/licenses/LICENSE,sha256=31u8x0SPgdOq3izJX41kgFazWsM43zPEF9eskzqbJMY,1075
216
- code_puppy-0.0.362.dist-info/RECORD,,
210
+ code_puppy-0.0.363.data/data/code_puppy/models.json,sha256=FMQdE_yvP_8y0xxt3K918UkFL9cZMYAqW1SfXcQkU_k,3105
211
+ code_puppy-0.0.363.data/data/code_puppy/models_dev_api.json,sha256=wHjkj-IM_fx1oHki6-GqtOoCrRMR0ScK0f-Iz0UEcy8,548187
212
+ code_puppy-0.0.363.dist-info/METADATA,sha256=58X4oyF3pg4edHx_1Rkru5_O-E6Ie3sI_UpZvF0-kfM,27614
213
+ code_puppy-0.0.363.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
214
+ code_puppy-0.0.363.dist-info/entry_points.txt,sha256=Tp4eQC99WY3HOKd3sdvb22vZODRq0XkZVNpXOag_KdI,91
215
+ code_puppy-0.0.363.dist-info/licenses/LICENSE,sha256=31u8x0SPgdOq3izJX41kgFazWsM43zPEF9eskzqbJMY,1075
216
+ code_puppy-0.0.363.dist-info/RECORD,,