code-puppy 0.0.200__py3-none-any.whl → 0.0.201__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/session_storage.py +74 -35
- {code_puppy-0.0.200.dist-info → code_puppy-0.0.201.dist-info}/METADATA +1 -1
- {code_puppy-0.0.200.dist-info → code_puppy-0.0.201.dist-info}/RECORD +7 -7
- {code_puppy-0.0.200.data → code_puppy-0.0.201.data}/data/code_puppy/models.json +0 -0
- {code_puppy-0.0.200.dist-info → code_puppy-0.0.201.dist-info}/WHEEL +0 -0
- {code_puppy-0.0.200.dist-info → code_puppy-0.0.201.dist-info}/entry_points.txt +0 -0
- {code_puppy-0.0.200.dist-info → code_puppy-0.0.201.dist-info}/licenses/LICENSE +0 -0
code_puppy/session_storage.py
CHANGED
@@ -177,48 +177,87 @@ async def restore_autosave_interactively(base_dir: Path) -> None:
|
|
177
177
|
return datetime.min
|
178
178
|
|
179
179
|
entries.sort(key=sort_key, reverse=True)
|
180
|
-
top_entries = entries[:5]
|
181
|
-
|
182
|
-
emit_system_message("[bold magenta]Autosave Sessions Available:[/bold magenta]")
|
183
|
-
for index, (name, timestamp, message_count) in enumerate(top_entries, start=1):
|
184
|
-
timestamp_display = timestamp or "unknown time"
|
185
|
-
message_display = (
|
186
|
-
f"{message_count} messages" if message_count is not None else "unknown size"
|
187
|
-
)
|
188
|
-
emit_system_message(
|
189
|
-
f" [{index}] {name} ({message_display}, saved at {timestamp_display})"
|
190
|
-
)
|
191
|
-
|
192
|
-
if len(entries) > len(top_entries):
|
193
|
-
emit_system_message(
|
194
|
-
f" [dim]...and {len(entries) - len(top_entries)} more autosaves[/dim]"
|
195
|
-
)
|
196
180
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
181
|
+
PAGE_SIZE = 5
|
182
|
+
total = len(entries)
|
183
|
+
page = 0
|
184
|
+
|
185
|
+
def render_page() -> None:
|
186
|
+
start = page * PAGE_SIZE
|
187
|
+
end = min(start + PAGE_SIZE, total)
|
188
|
+
page_entries = entries[start:end]
|
189
|
+
emit_system_message("[bold magenta]Autosave Sessions Available:[/bold magenta]")
|
190
|
+
for idx, (name, timestamp, message_count) in enumerate(page_entries, start=1):
|
191
|
+
timestamp_display = timestamp or "unknown time"
|
192
|
+
message_display = (
|
193
|
+
f"{message_count} messages" if message_count is not None else "unknown size"
|
194
|
+
)
|
195
|
+
emit_system_message(
|
196
|
+
f" [{idx}] {name} ({message_display}, saved at {timestamp_display})"
|
197
|
+
)
|
198
|
+
# If there are more pages, offer next-page; show 'Return to first page' on last page
|
199
|
+
if total > PAGE_SIZE:
|
200
|
+
page_count = (total + PAGE_SIZE - 1) // PAGE_SIZE
|
201
|
+
is_last_page = (page + 1) >= page_count
|
202
|
+
remaining = total - (page * PAGE_SIZE + len(page_entries))
|
203
|
+
summary = f" and {remaining} more" if (remaining > 0 and not is_last_page) else ""
|
204
|
+
label = "Return to first page" if is_last_page else f"Next page{summary}"
|
205
|
+
emit_system_message(f" [6] {label}")
|
206
|
+
emit_system_message(" [Enter] Skip loading autosave")
|
207
|
+
|
208
|
+
chosen_name: str | None = None
|
209
|
+
|
210
|
+
while True:
|
211
|
+
render_page()
|
212
|
+
try:
|
213
|
+
selection = await get_input_with_combined_completion(
|
214
|
+
FormattedText(
|
215
|
+
[
|
216
|
+
(
|
217
|
+
"class:prompt",
|
218
|
+
"Pick 1-5 to load, 6 for next, or name/Enter: ",
|
219
|
+
)
|
220
|
+
]
|
221
|
+
)
|
222
|
+
)
|
223
|
+
except (KeyboardInterrupt, EOFError):
|
224
|
+
emit_warning("Autosave selection cancelled")
|
225
|
+
return
|
226
|
+
|
227
|
+
selection = (selection or "").strip()
|
228
|
+
if not selection:
|
229
|
+
return
|
230
|
+
|
231
|
+
# Numeric choice: 1-5 select within current page; 6 advances page
|
232
|
+
if selection.isdigit():
|
233
|
+
num = int(selection)
|
234
|
+
if num == 6 and total > PAGE_SIZE:
|
235
|
+
page = (page + 1) % ((total + PAGE_SIZE - 1) // PAGE_SIZE)
|
236
|
+
# loop and re-render next page
|
237
|
+
continue
|
238
|
+
if 1 <= num <= 5:
|
239
|
+
start = page * PAGE_SIZE
|
240
|
+
idx = start + (num - 1)
|
241
|
+
if 0 <= idx < total:
|
242
|
+
chosen_name = entries[idx][0]
|
243
|
+
break
|
244
|
+
else:
|
245
|
+
emit_warning("Invalid selection for this page")
|
246
|
+
continue
|
247
|
+
emit_warning("Invalid selection; choose 1-5 or 6 for next")
|
248
|
+
continue
|
208
249
|
|
209
|
-
|
210
|
-
|
211
|
-
idx = int(selection) - 1
|
212
|
-
if 0 <= idx < len(top_entries):
|
213
|
-
chosen_name = top_entries[idx][0]
|
214
|
-
else:
|
215
|
-
for name, _, _ in entries:
|
250
|
+
# Allow direct typing by exact session name
|
251
|
+
for name, _ts, _mc in entries:
|
216
252
|
if name == selection:
|
217
253
|
chosen_name = name
|
218
254
|
break
|
255
|
+
if chosen_name:
|
256
|
+
break
|
257
|
+
emit_warning("No autosave loaded (invalid selection)")
|
258
|
+
# keep looping and allow another try
|
219
259
|
|
220
260
|
if not chosen_name:
|
221
|
-
emit_warning("No autosave loaded (invalid selection)")
|
222
261
|
return
|
223
262
|
|
224
263
|
try:
|
@@ -8,7 +8,7 @@ code_puppy/model_factory.py,sha256=ZbIAJWMNKNdTCEMQK8Ig6TDDZlVNyGO9hOLHoLLPMYw,1
|
|
8
8
|
code_puppy/models.json,sha256=dClUciCo2RlVDs0ZAQCIur8MOavZUEAXHEecn0uPa-4,1629
|
9
9
|
code_puppy/reopenable_async_client.py,sha256=4UJRaMp5np8cbef9F0zKQ7TPKOfyf5U-Kv-0zYUWDho,8274
|
10
10
|
code_puppy/round_robin_model.py,sha256=UEfw-Ix7GpNRWSxxuJtA-EE4_A46KXjMgFRciprfLmg,5634
|
11
|
-
code_puppy/session_storage.py,sha256=
|
11
|
+
code_puppy/session_storage.py,sha256=Pf5C-qyC6xLhZCTlbAdkPwOFyqlaDomVnj9Z4cZcZsE,9595
|
12
12
|
code_puppy/status_display.py,sha256=F6eEAkGePDp4StM2BWj-uLLQTDGtJrf0IufzCeP1rRg,8336
|
13
13
|
code_puppy/summarization_agent.py,sha256=LnObgtLmM6N4z2553XXQlXAOf8R1BPSNmFSfXkjpivg,3211
|
14
14
|
code_puppy/tui_state.py,sha256=TT76XBVapKj6fKjFzz6oxCONeN_BZwcMILxxZcxu6-Y,1171
|
@@ -123,9 +123,9 @@ code_puppy/tui/screens/help.py,sha256=eJuPaOOCp7ZSUlecearqsuX6caxWv7NQszUh0tZJjB
|
|
123
123
|
code_puppy/tui/screens/mcp_install_wizard.py,sha256=vObpQwLbXjQsxmSg-WCasoev1usEi0pollKnL0SHu9U,27693
|
124
124
|
code_puppy/tui/screens/settings.py,sha256=EoMxiguyeF0srwV1bj4_MG9rrxkNthh6TdTNsxnXLfE,11460
|
125
125
|
code_puppy/tui/screens/tools.py,sha256=3pr2Xkpa9Js6Yhf1A3_wQVRzFOui-KDB82LwrsdBtyk,1715
|
126
|
-
code_puppy-0.0.
|
127
|
-
code_puppy-0.0.
|
128
|
-
code_puppy-0.0.
|
129
|
-
code_puppy-0.0.
|
130
|
-
code_puppy-0.0.
|
131
|
-
code_puppy-0.0.
|
126
|
+
code_puppy-0.0.201.data/data/code_puppy/models.json,sha256=dClUciCo2RlVDs0ZAQCIur8MOavZUEAXHEecn0uPa-4,1629
|
127
|
+
code_puppy-0.0.201.dist-info/METADATA,sha256=aych9u0aHR3SOsgBysmVF12b5JukUSqymvX0gOXdQ3w,20759
|
128
|
+
code_puppy-0.0.201.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
129
|
+
code_puppy-0.0.201.dist-info/entry_points.txt,sha256=Tp4eQC99WY3HOKd3sdvb22vZODRq0XkZVNpXOag_KdI,91
|
130
|
+
code_puppy-0.0.201.dist-info/licenses/LICENSE,sha256=31u8x0SPgdOq3izJX41kgFazWsM43zPEF9eskzqbJMY,1075
|
131
|
+
code_puppy-0.0.201.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|